主题
通过DMA搜索整数Ex - DmaFindIntEx
函数简介
通过 DMA 搜索指定范围内的整数,支持自定义步长和多线程选项。(高级版功能,普通版无法使用)
接口名称
DmaFindIntExDLL调用
c
OLA_STRING_RETURN OLA_CALL_TYPE DmaFindIntEx(int64_t instance, int64_t deviceId, int32_t pid, OLA_STRING_INPUT addr_range, int64_t int_value_min, int64_t int_value_max, int32_t type, int32_t step, int32_t multi_thread, int32_t mode);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| deviceId | 长整数型 | 设备ID |
| pid | 整数型 | 进程 PID |
| addr_range | 字符串 | 地址范围,格式:0x开始地址-0x结束地址 |
| int_value_min | 长整数型 | 最小值(包含边界) |
| int_value_max | 长整数型 | 最大值(包含边界) |
| type | 整数型 | 整数类型:0=32位有符号, 1=16位有符号, 2=8位有符号, 3=64位, 4=32位无符号, 5=16位无符号, 6=8位无符号 |
| step | 整数型 | 步长(1=逐字节, 4=推荐) |
| multi_thread | 整数型 | 是否开启多线程(0=否, 1=是) |
| mode | 整数型 | 搜索模式:0=全部, 1=可写, 2=不可写, 4=可执行, 8=不可执行, 16=写时复制, 32=不写时复制 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
std::string result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);csharp
using OLAPlug;
var ola = new OLAPlugServer();
string result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
String result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);cpp
var ola = com("OlaPlug.OlaSoft")
var result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0)text
.局部变量 ola, OLAPlug
ola.创建 ()
result = ola.DmaFindIntEx(0, 1234, “0x开始地址-0x结束地址”, 0, 0, 0, 0, 0, 0)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
文本型 result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
std::string result = ola.DmaFindIntEx(0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);原生 DLL 调用
cpp
long ptr = DmaFindIntEx(instance, 0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);
if (ptr != 0) {
char buffer[512] = {0};
GetStringFromPtr(ptr, buffer, sizeof(buffer));
FreeStringPtr(ptr);
}csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int DmaFindIntEx(long ola, int deviceId, int pid, string addr_range, int int_value_min, int int_value_max, int type, int step, int multi_thread, int mode);
long ptr = DmaFindIntEx(instance, 0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0);
if (ptr != 0) {
StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
GetStringFromPtr(ptr, sb, sb.Capacity);
FreeStringPtr(ptr);
string result = sb.ToString();
}python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ptr = ola.DmaFindIntEx(instance, 0, 1234, "0x开始地址-0x结束地址", 0, 0, 0, 0, 0, 0)
if ptr:
buf = create_string_buffer(512)
ola.GetStringFromPtr(ptr, buf, 512)
ola.FreeStringPtr(ptr)
result = buf.value.decode("utf-8")返回值
字符串指针,数据格式为 addr1|addr2|addr3...,示例:123456|ff001122|dc12366。
返回的字符串指针需要调用 FreeStringPtr 释放内存。
